package chapter09;

public class AnimalTest {
    public static void main(String[] args) {
        System.out.println("----(正常方法调用)----");
        Animal animal = new Animal();
        animal.eat();

        Cat cat = new Cat();
        cat.eat();

        Dog dog = new Dog();
        dog.eat();
        System.out.println("-----(多态方法调用)-----");
        Animal animals1 = new Cat();
        animals1.eat();

        Animal animals2 = new Dog();
        animals2.eat();


        Cat cat1= (Cat) animals1;
        cat1.catchRat();
        cat1.eat();

    }
}


